<?php
//plancuenta
class Cpla extends Controller {
	function cpla(){
		parent::Controller();
		$this->load->library("rapyd");
	}

	function index() {
		$this->rapyd->load("datagrid","datafilter");

		$filter = new DataFilter("Filtro de Plan de cuentas",'cpla');

		$filter->codigo   = new inputField("Cuenta","cuenta");
		$filter->codigo->like_side='after';
		$filter->codigo->size=15;

		$filter->descrip = new inputField("Descripci&oacute;n", "descrip");

		$filter->buttons('reset','search');
		$filter->build();

		$uri = anchor('finanzas/cpla/dataedit/show/<#cuenta#>','<#cuenta#>');

		$grid = new DataGrid();
		$grid->order_by("cuenta","asc");
		$grid->per_page = 15;

		$grid->column("Cuenta"     ,$uri);
		$grid->column("Descripci&oacute;n","descrip");
        $grid->column("Tipo","clase");
		$grid->column("Cuenta Destino"  ,"ajuste","align='center'");
		$grid->column("Cuenta Destino"  ,"contrapartida" ,"align='center'");

		$grid->add('finanzas/cpla/dataedit/create');
		$grid->build();
        
        $data['filtro']  = $filter->output;
		$data['content'] = $grid->output;
		$data['head']    = $this->rapyd->get_head();
		$data['title']   = heading('Plan de Cuentas');
		$this->load->view('view_ventanas', $data);
	}

	function dataedit(){
		$this->rapyd->load('dataedit');

		$edit = new DataEdit('Plan de cuenta (10 Cararteres por cuenta)','cpla');
		$edit->back_url = 'finanzas/cpla';

		$edit->codigo = new inputField('Cuenta', 'cuenta');
		$edit->codigo->mode= 'autohide';
		$edit->codigo->size=15;
		$edit->codigo->maxlength =10 ;

		$edit->descrip = new inputField('Descripci&oacute;n', 'descrip');
		$edit->descrip->rule= 'required';
		$edit->descrip->size=45;
		$edit->descrip->maxlength =35;
        
        $edit->clase = new dropdownField("Clase", "clase");
		$edit->clase->option("","Ninguna" );
        $edit->clase->option("Act","Activo" );
        $edit->clase->option("Pas","Pasivo" );
        $edit->clase->option("Egr","Egreso" );
        
		$edit->ajuste = new inputField('Cuenta Destino', 'ajuste');
		//$edit->ajuste->rule= 'required';
		$edit->ajuste->size=15;
		$edit->ajuste->maxlength =10;
        
        $edit->contrapartida = new inputField('Cuenta Destino', 'contrapartida');
		//$edit->contrapartida->rule= 'required';
		$edit->contrapartida->size=15;
		$edit->contrapartida->maxlength =10;

		$edit->buttons('modify', 'save', 'undo', 'delete', 'back');
		$edit->build();

		$data['content'] = $edit->output;
		$data['head']    = $this->rapyd->get_head();
		$data['title']   = heading('Plan de Cuentas');
		$this->load->view('view_ventanas', $data);
	}

}
?>
